import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Random;

/**
 * Created by dllo on 18/4/3.
 */
public class Question002 {
    public static void main(String[] args) {
        Random random = new Random();
        int[] arr = new int[20];

        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(20);
        }

        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
            if (i != arr.length - 1) {
                // 只要不是最后一个数组,就加上一个逗号
                System.out.print(",");
            }
        }
        System.out.println("]");

        int length = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > 10) {
                length++;
            }
        }
        int[] newArr = new int[length];

        int index = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > 10) {
                newArr[index] = arr[i];
                index++;
            }
        }
        for (int i = 0; i < newArr.length; i++) {
            System.out.print(newArr[i] + ",");
        }
    }
}
